v
<!DOCTYPE >
<html lang="zh-cn">

	<head>
		<title>后台管理-单人管理</title>
		<% include ../partials/head %>
			<link rel="stylesheet" href="/assets/js/button/ladda/ladda.min.css">
			<script type="text/javascript">
				var userManage = {
					operator: function() {
						$("#searchButton").on("click", function() {
							if ($("#searchUser").val() == "") {
								alert("请输入内容");
							} else {
								window.location.href = "/admin/member?param=" + $("#searchUser").val();
							}
						})
						$("table").on('click', '.addArticle', function() {
							$this = $(this)
						}).on('click', '.publish', function() {
							$this = $(this);
							if (window.confirm('你确定发布该用户的文章吗？')) {
								//拒绝
								$.post("/admin/member/article/publish", {
									"articleId": $this.attr('articleId'),
									"status": 1,
								}, function(json) {
									if (json.code == 0) {
										history.go(0)
									} else {
										alert(json.msg);
									}
								}, 'json');
							} else {
								//取消
							}
						}).on('click', '.depublish', function() {
							$this = $(this);
							if (window.confirm('你确定下架该用户的文章吗？')) {
								$.post("/admin/member/article/publish", {
									"articleId": $this.attr('articleId'),
									"status": 0,
								}, function(json) {
									if (json.code == 0) {
										history.go(0)
									} else {
										alert(json.msg);
									}
								}, 'json');
							} else {
								//取消
							}
						}).on("click", ".contact", function() {
							$this = $(this)
							if (window.confirm('你确定要联系他么？')) {
								//拒绝 
								$.post("/admin/member/contact", {
									"userId": $this.attr('userId'),
									"content": $this.parent().find(".contactContent").val()
								}, function(json) {
									if (json.code == 0) {
										alert(json.msg);
									} else {
										alert(json.msg);
									}
								}, 'json');
							} else {
								//取消
							}
						})
					},
					init: function() {
						this.operator();
					}
				}
				$(document).ready(function() {
					userManage.init();
				})
			</script>
	</head>

	<body>
		<header>
			<!-- Preloader -->
			<div id="preloader">
				<div id="status">&nbsp;</div>
			</div>
		</header>
		<div class="ch-container">

			<!-- 首页内容 -->
			<div class="wrap-fluid">
				<div class="container-fluid paper-wrap bevel tlbr">

					<!-- CONTENT -->
					<!--TITLE -->

					<!--/ TITLE -->

					<!-- BREADCRUMB -->
					<ul id="breadcrumb">
						<li>
							<span class="entypo-home"></span>
						</li>
						<li><i class="fa fa-lg fa-angle-right"></i>
						</li>
						<li><a href="#" title="公司管理">单人管理管理</a>
						</li>
					</ul>

					<!--测试数据-->
					<div class="content-wrap">
						<div class="row">
							<div class="col-sm-12">
								<div class="nest" id="FootableClose">
									<div class="title-alt">
										<h6>单人管理</h6>
										<div class="titleClose">
											<a class="gone" href="#FootableClose">
												<span class="entypo-cancel"></span>
											</a>
										</div>
										<div class="titleToggle">
											<a class="nav-toggle-alt" href="#Footable">
												<span class="entypo-up-open"></span>
											</a>
										</div>

									</div>
									<div class="body-nest" id="Filtering">

										<div class="row" style="margin-bottom:10px;">
											<div class="col-sm-4">
												<input class="form-control" id="searchUser" placeholder="根据手机号或ID查找" type="text">

											</div>
											<div class="col-sm-2"><span class="btn btn-success" id="searchButton">查找</span></div>

										</div>
										<table class="table-striped footable-res footable metro-blue data-table" data-page-size="100" data-filter="#filter" data-filter-text-only="true">
											<thead>
												<tr>
													<th data-toggle="true"></th>
													<th>昵称</th>
													<th>团号</th>
													<th>文章</th>
													<th>电话</th>
													<th>微信号</th>
													<th>联系TA</th>
													<th>会员类型</th>
													<th>注册时间</th>
												</tr>
											</thead>
											<tbody>
												<% if (typeof users != "undefined") { %>
													<% users.forEach(function(user,index) { %>

														<tr>
															<td class="center">
																<%=index%>
															</td>
															<td class="center">
																<a href="/admin/userinfo?userId=<%=user.id%>">
																	<%= user.get("nickname") %>
																</a>
															</td>
															<td class="center">
																<%= user.get("molianId") %>
															</td>
															<% if (typeof user.get("belongToArticle") != "undefined") { %>
																<td class="center">
																	<%= user.get("belongToArticle").get("title") %>
																		<p>
																			<a class="btn btn-info" href="/member/article?id=<%=user.get("belongToArticle").id %>">查看<a/>
																		<a class="btn btn-info" href="/admin/member/article/edit?id=<%=user.get("belongToArticle").id %>">编辑<a/>
																		<% if(user.get("belongToArticle").get("status")==0){%>
																		<span class="btn btn-success publish " articleId=<%=user.get("belongToArticle").id%>>上线</span>
																		<%}else{%>
																			<span class="btn btn-danger depublish " articleId=<%=user.get("belongToArticle").id%>>下线</span>
																		<%}%></p>
																		
																</td>
																<%}else{%>
																	<td class="center"><a href="/admin/member/article/add?userId=<%=user.id%>"><span class="btn public ladda-button btn-success addArticle" userId=<%=user.id%>>添加文章</span></a></td>
																<%}%>
																	<td class="center">
																		<%= user.get("mobilePhoneNumber") %>
																	</td>
																	<td class="center">
																		<%= user.get("weChat") %>
																	</td>
																	<td class="center">
																		<input class="contactContent" type="text" placeholder="联系他">
																		<span class="btn btn-success contact " userId=<%=user.id%>>联系他</span>
																	</td>
																	<td class="center">
																		<%if(user.get('level')==0){%>
																			普通会员
																			<%}else if(user.get("level")==1){%>
																				黄金会员
																				<%}else{%>
																					白金会员
																					<%}%>
																	</td>
																	<td class="center">
																		<%= Format(user.createdAt) %>
																	</td>

														</tr>
														<% }) %>
															<% } %>

											</tbody>
											<tfoot>
												<tr>
													<td colspan="5">
														<div class="pagination pagination-centered"></div>
													</td>
												</tr>
											</tfoot>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- END OF BREADCRUMB -->

					<!-- /END OF CONTENT -->

					<!-- FOOTER -->
					<div class="footer-space"></div>
					<div id="footer">
						<div class="devider-footer-left"></div>
						<div class="time">
							<p id="spanDate">
								<p id="clock">
						</div>
						<div class="copyright">Made by HT
							<span class="entypo-heart"></span>广州聚脉互联网络服务有限公司</div>
						<div class="devider-footer"></div>

					</div>
					<!-- / END OF FOOTER -->

				</div>
			</div>

		</div>
		<% include ../partials/external %>
			<script src="/assets/js/button/ladda/spin.min.js"></script>

			<script src="/assets/js/button/ladda/ladda.min.js"></script>

			<script src="/assets/js/footable/js/footable.filter.js"></script>

			<script type="text/javascript">
				$(function() {
					$('table').on("click", ".viewaddr", function() {
						window.location.href = $(this).attr("addr");
					}).on("click", ".editarticle", function() {
						window.location.href = "/admin/home/article/edit?id=" + $(this).attr("articleId");
					})
				});
			</script>
			<script type="text/javascript">
			$(function() {
					$('.footable-res').footable();
				});
			</script>
	</body>

</html>